<script type="text/javascript">
$(function(){
//    $(".contentpanel").find(".panel:first").css({'height':$(window).height()-68});
    $(".disk_pro_div").hide();
    $("#placeHolder").show();

    $(".manage .disk_block").click(function(){
        if($(this).find(".disk_pro_div").css("display")=="none"){
            $(this).find(".disk_pro_div").show();  
            $(this).find(".legendPlaceHolder").show();  
            $(this).siblings().find(".disk_pro_div").hide();  
            $(this).siblings().find(".legendPlaceHolder").hide();  
            host_id = $(this).find(".disk_pro_div").attr('id');
            loadGlobal($(this).find(".disk_pro_div"), "/disk/list?host_id="+host_id);
            
            //$(this).find(".disk_pro_div").load("/disk/list?host_id="+host_id);
       }      
    });
    $(".manage .disk_block").eq('0').trigger('click');
});
    {% if raid_missing_hostids %}
        var hostips = "{{raid_missing_hostips}}";
        angular.element('#disk_modal_controller').scope().open('raid_missing_confirm?hostids={{raid_missing_hostids}}&hostips='+hostips);
    {% endif %}

    function raid_missing(){
        $(".callback_device_tip").text("正在提交中......").css({"display":"block","color":'#000'}); 
        $.get('/raid_missing', {'hostids': '{{ raid_missing_hostids }}'}, function(data){
            if (data.reply.is_success){
                angular.element('#disk_modal_controller').scope().close();
            }
            else {
                error =  data.reply.error;
                $(".callback_device_tip").text(error).css({"display":"block","color":'#000'});             		
            }
        });
    }

    $(window).resize(function(){
        var wscroll = $(".disk_block").width();
        {% for host in hosts %}
        $("#gview_tb_node_device_single_{{host.id}}").width(wscroll); 
        {% endfor %}
    });
</script>
<style>
    .disk_warp{
        border:1px solid #ccc;   
        width:100%;
    }
    .disk_block{
        border-bottom:1px solid #ccc;     
        width:100%;
    }
    .colony_name{
        height:26px;
        line-height:25px;
        text-align:left;
        border-bottom: 1px solid #ccc;
        cursor:pointer;
        padding-left:10px;
    }
    .colony_name:hover{
        background-color:#f5f5f5;   
        width:100%;
    }
    label{
        margin-bottom: 0px !important;
    }
    .ui-jqgrid{  
        border:none;
    }
    .disk_pro_div{
        width:100%;   
    }
</style>
<div class="panel panel-default">
        <div class="panel-body">
            <div class="conf_des">
                   [[ "if a string just like ‘xx73O0A008FTN11330xx’ appears in the path, that means the disk hasn’t done disk controller configuration. You can click “Join RAID” to complete the disk initialization"|translate]]
            </div>
            <div class="disk_warp manage">
                {% for host in hosts %}
            <div class="disk_block" >
                <div class="colony_name">{{ host.ip }}</div>
                <div class="disk_pro_div"  id={{host.id}}>
                </div>   <!-- disk_pro_div -->
            </div>
                {% endfor %}
            </div>
        </div>
</div> <!-- panel-default -->
